<template>
    <div>
        <div style="background-color: #d9d9d9;font-size: 30px;"><span style="margin-left: 30px;">修改密码</span></div>
        <div style="margin-top: 30px;margin-left: 30px;">
            <el-form  v-model="userInfo" style="width: 300px;">
                <el-form-item label="旧密码" >
                    <el-input    type="text"  v-model="userInfo.paw" clearable ></el-input>
                </el-form-item>
                <el-form-item label="新密码" >
                    <el-input   type="password" v-model="userInfo.paw2"   clearable></el-input>
                </el-form-item>
                <el-button  @click="updaPaw()">修改密码</el-button>
            </el-form>
        </div>

    </div>
</template>

<script>




    export default {
        name: "pasw",
        data(){
            return{
            userInfo:{
                paw2:'',
            },
            }
        },
        created(){
            this.$axios.get("/api/user/main/info",{headers:{TOKEN:this.token}}).then(res=>{
                    this.userInfo=res.data.data;
            })
        },
        methods:{
            updaPaw(){
                this.userInfo.paw=this.userInfo.paw2;
                console.log(  this.userInfo.paw)
                this.$axios.post("/api/user/updaPaw",this.userInfo).then(res=>{
                    if (res.data.status===1){
                        this.$message.success(res.data.msg)
                    }else {
                        this.$message.error(res.data.msg)
                    }
                })
            }
        }
    }
</script>

<style scoped>

</style>